import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;

public class Enemy2 extends GameObject{

//	public Image image;
//	public int x, y;
	Rectangle rect;
	public long prevBullet1Time;

//	public boolean active;// 활성화 여부 -> 이 값이 false이면 관리 목록에서 제거
	public boolean upDown;
	public boolean target = true;
//	public int damageCount = 0;

	public Enemy2(Image image) {
		this.image = image;
		x = Constants.SCREEN_WIDTH;
		y = (int)(Math.random()*527);
		//적2가 처음 나타나는 좌표

		rect = new Rectangle(image.getWidth(null), image.getHeight(null));
	}

	public void update() {
		x = x - 1;

		if(x<(0-image.getWidth(null)) || y>(Constants.SCREEN_HEIGHT+image.getHeight(null)) || y<(0-image.getHeight(null))){
			active = false;
		}
	}

	public void render(Graphics g) {
		if (active) {// 활성 상태일 경우에만 화면에 출력
			g.drawImage(image, x, y, null);
		}
	}

	public Rectangle getArea() {
		rect.x = x;
		rect.y = y;
		return rect;
	}
}
